package com.lh.Mybatis.controller;

import com.lh.Mybatis.model.Emp;
import com.lh.Mybatis.service.EmpService;
import com.lh.Mybatis.util.JsonTools;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;

/**
 * 作者：idea
 * 日期：2018/7/5
 * 描述：
 */
@WebServlet(name = "/emp/findAll",urlPatterns = "/emp/findAll")
public class EmpFindAll extends HttpServlet {

    public JsonTools<Emp> jsonTools=new JsonTools<Emp>();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        PrintWriter out=resp.getWriter();
        EmpService es=new EmpService();
        out.write(jsonTools.parseNoHeaderJArray(es.findAll()));
        out.close();
    }
}
